package com.intct.flink.sql;

import org.apache.flink.connector.datagen.table.DataGenConnectorOptions;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.table.api.DataTypes;
import org.apache.flink.table.api.Schema;
import org.apache.flink.table.api.TableDescriptor;
import org.apache.flink.table.api.TableResult;
import org.apache.flink.table.api.bridge.java.StreamTableEnvironment;

/**
 * @author gufg
 * @since 2025-07-01 11:38
 */
public class FlinkSQLDemo3 {
    public static void main(String[] args) {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        StreamTableEnvironment tEnv = StreamTableEnvironment.create(env);

        // 创建临时表
        tEnv.executeSql(
                "create table MyTable(" +
                        "f1 STRING" +
                        ") " +
                "with (" +
                "'connector'='datagen'," +
                "'rows-per-second'='5'" +
                ")");

        tEnv.sqlQuery("select * from MyTable").execute().print();
    }
}
